home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / ADSPSecure.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  6.6 KB  |  204 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        ADSPSecure.h
  3.  
  4.      Contains:    Secure AppleTalk Data Stream Protocol Interfaces.
  5.  
  6.      Version:    Technology:    AOCE Toolbox 1.02
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1994-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __ADSPSECURE__
  18. #define __ADSPSECURE__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __ADSP__
  25.     #include <ADSP.h>
  26. #endif
  27.  
  28. #ifndef __OCEAUTHDIR__
  29.     #include <OCEAuthDir.h>
  30. #endif
  31.  
  32.  
  33.  
  34.  
  35. #if PRAGMA_ONCE
  36. #pragma once
  37. #endif
  38.  
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42.  
  43. #if PRAGMA_IMPORT
  44. #pragma import on
  45. #endif
  46.  
  47. #if PRAGMA_STRUCT_ALIGN
  48.     #pragma options align=mac68k
  49. #elif PRAGMA_STRUCT_PACKPUSH
  50.     #pragma pack(push, 2)
  51. #elif PRAGMA_STRUCT_PACK
  52.     #pragma pack(2)
  53. #endif
  54.  
  55. /* New ADSP control codes
  56.  
  57.  * open a secure connection */
  58. enum {
  59.     sdspOpen                    = 229
  60. };
  61.  
  62. /*
  63. For secure connections, the eom field of ioParams contains two single-bit flags
  64. (instead of a zero/non-zero byte). They are an encrypt flag (see below), and an
  65. eom flag.  All other bits in that field should be zero.
  66.  
  67. To write an encrypted message, you must set an encrypt bit in the eom field of
  68. the ioParams of your write call. Note: this flag is only checked on the first
  69. write of a message (the first write on a connection, or the first write following
  70. a write with eom set.
  71. */
  72. enum {
  73.     dspEOMBit                    = 0,                            /* set if EOM at end of write */
  74.     dspEncryptBit                = 1                                /* set to encrypt message */
  75. };
  76.  
  77. enum {
  78.     dspEOMMask                    = 1 << dspEOMBit,
  79.     dspEncryptMask                = 1 << dspEncryptBit
  80. };
  81.  
  82.  
  83. /*
  84. Define an ADSPSecure parameter block, as used for the secure Open call.
  85.  
  86.  * size of ADSPSecure workspace */
  87. enum {
  88.     sdspWorkSize                = 2048
  89. };
  90.  
  91.  
  92. struct TRSecureParams {
  93.     unsigned short                     localCID;                    /* local connection id */
  94.     unsigned short                     remoteCID;                    /* remote connection id */
  95.     AddrBlock                         remoteAddress;                /* address of remote end */
  96.     AddrBlock                         filterAddress;                /* address filter */
  97.     unsigned long                     sendSeq;                    /* local send sequence number */
  98.     unsigned short                     sendWindow;                    /* send window size */
  99.     unsigned long                     recvSeq;                    /* receive sequence number */
  100.     unsigned long                     attnSendSeq;                /* attention send sequence number */
  101.     unsigned long                     attnRecvSeq;                /* attention receive sequence number */
  102.     unsigned char                     ocMode;                        /* open connection mode */
  103.     unsigned char                     ocInterval;                    /* open connection request retry interval */
  104.     unsigned char                     ocMaximum;                    /* open connection request retry maximum */
  105.  
  106.     Boolean                         secure;                        /*  --> TRUE if session was authenticated */
  107.     AuthKeyPtr                         sessionKey;                    /* <--> encryption key for session */
  108.     unsigned long                     credentialsSize;            /*  --> length of credentials */
  109.     void *                            credentials;                /*  --> pointer to credentials */
  110.     void *                            workspace;                    /*  --> pointer to workspace for connection align on even boundary and length = sdspWorkSize */
  111.     AuthIdentity                     recipient;                    /*  --> identity of recipient (or initiator if active mode */
  112.     UTCTime                         issueTime;                    /*  --> when credentials were issued */
  113.     UTCTime                         expiry;                        /*  --> when credentials expiry */
  114.     RecordIDPtr                     initiator;                    /* <--  RecordID of initiator returned here. Must give appropriate Buffer to hold RecordID (Only for passive or accept mode) */
  115.     Boolean                         hasIntermediary;            /* <--  will be set if credentials has an intermediary */
  116.     Boolean                         filler1;
  117.     RecordIDPtr                     intermediary;                /* <--  RecordID of intermediary returned here. (If intermediary is found in credentials Must give appropriate Buffer to hold RecordID (Only for passive or accept mode) */
  118. };
  119. typedef struct TRSecureParams            TRSecureParams;
  120. typedef struct SDSPParamBlock             SDSPParamBlock;
  121.  
  122. typedef SDSPParamBlock *                SDSPPBPtr;
  123. typedef CALLBACK_API( void , SDSPIOCompletionProcPtr )(SDSPPBPtr paramBlock);
  124. /*
  125.     WARNING: SDSPIOCompletionProcPtr uses register based parameters under classic 68k
  126.              and cannot be written in a high-level language without 
  127.              the help of mixed mode or assembly glue.
  128. */
  129. typedef REGISTER_UPP_TYPE(SDSPIOCompletionProcPtr)                 SDSPIOCompletionUPP;
  130.  
  131. struct SDSPParamBlock {
  132.     QElem *                            qLink;
  133.     short                             qType;
  134.     short                             ioTrap;
  135.     Ptr                             ioCmdAddr;
  136.     SDSPIOCompletionUPP             ioCompletion;
  137.     OSErr                             ioResult;
  138.     StringPtr                         ioNamePtr;
  139.     short                             ioVRefNum;
  140.     short                             ioCRefNum;                    /* adsp driver refNum */
  141.     short                             csCode;                        /* adsp driver control code */
  142.     long                             qStatus;                    /* adsp internal use */
  143.     short                             ccbRefNum;
  144.     union {
  145.         TRinitParams                     initParams;                /* dspInit, dspCLInit */
  146.         TRopenParams                     openParams;                /* dspOpen, dspCLListen, dspCLDeny */
  147.         TRcloseParams                     closeParams;            /*dspClose, dspRemove*/
  148.         TRioParams                         ioParams;                /*dspRead, dspWrite*/
  149.         TRattnParams                     attnParams;                /*dspAttention*/
  150.         TRstatusParams                     statusParams;            /*dspStatus*/
  151.         TRoptionParams                     optionParams;            /*dspOptions*/
  152.         TRnewcidParams                     newCIDParams;            /*dspNewCID*/
  153.         TRSecureParams                     secureParams;            /* dspOpenSecure */
  154.     }                                 u;
  155. };
  156.  
  157. #if OPAQUE_UPP_TYPES
  158.     EXTERN_API(SDSPIOCompletionUPP)
  159.     NewSDSPIOCompletionUPP           (SDSPIOCompletionProcPtr    userRoutine);
  160.  
  161.     EXTERN_API(void)
  162.     DisposeSDSPIOCompletionUPP       (SDSPIOCompletionUPP        userUPP);
  163.  
  164.     EXTERN_API(void)
  165.     InvokeSDSPIOCompletionUPP       (SDSPPBPtr                paramBlock,
  166.                                     SDSPIOCompletionUPP        userUPP);
  167.  
  168. #else
  169.     enum { uppSDSPIOCompletionProcInfo = 0x00009802 };                 /* register no_return_value Func(4_bytes:A0) */
  170.     #define NewSDSPIOCompletionUPP(userRoutine)                     (SDSPIOCompletionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSDSPIOCompletionProcInfo, GetCurrentArchitecture())
  171.     #define DisposeSDSPIOCompletionUPP(userUPP)                     DisposeRoutineDescriptor(userUPP)
  172.     #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  173.     #pragma parameter InvokeSDSPIOCompletionUPP(__A0, __A1)
  174.     void InvokeSDSPIOCompletionUPP(SDSPPBPtr paramBlock, SDSPIOCompletionUPP userUPP) = 0x4E91;
  175.     #else
  176.         #define InvokeSDSPIOCompletionUPP(paramBlock, userUPP)             CALL_ONE_PARAMETER_UPP((userUPP), uppSDSPIOCompletionProcInfo, (paramBlock))
  177.     #endif
  178. #endif
  179. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  180. #define NewSDSPIOCompletionProc(userRoutine)                     NewSDSPIOCompletionUPP(userRoutine)
  181. #define CallSDSPIOCompletionProc(userRoutine, paramBlock)        InvokeSDSPIOCompletionUPP(paramBlock, userRoutine)
  182.  
  183.  
  184. #if PRAGMA_STRUCT_ALIGN
  185.     #pragma options align=reset
  186. #elif PRAGMA_STRUCT_PACKPUSH
  187.     #pragma pack(pop)
  188. #elif PRAGMA_STRUCT_PACK
  189.     #pragma pack()
  190. #endif
  191.  
  192. #ifdef PRAGMA_IMPORT_OFF
  193. #pragma import off
  194. #elif PRAGMA_IMPORT
  195. #pragma import reset
  196. #endif
  197.  
  198. #ifdef __cplusplus
  199. }
  200. #endif
  201.  
  202. #endif /* __ADSPSECURE__ */
  203.  
  204.